package com.lry.basic.jvm.asm.transform_class.demo5;

import aj.org.objectweb.asm.ClassVisitor;
import aj.org.objectweb.asm.FieldVisitor;
import aj.org.objectweb.asm.MethodVisitor;

public class RemoveMethodVisitor extends ClassVisitor {
    private final String methodName;
    private final String methodDesc;


    public RemoveMethodVisitor(int api, ClassVisitor cv, String methodName, String methodDesc) {
        super(api,cv);
        this.methodDesc = methodDesc;
        this.methodName = methodName;
    }


    @Override
    public MethodVisitor visitMethod(int access, String name, String desc, String sig, String[] exceptions) {
        if(name.equals(methodName)&&desc.equals(methodDesc))
            return null;
        return super.visitMethod(access,name, desc, sig, exceptions);
    }
}
